<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var arr = [];
      var aver = [];
      var tmp = 0;
      for (i = 1; i <= 30; i++) {
        tmp += 2 * i;
        arr.push(2 * i);
        if (i % 5 == 0) {
          aver.push(tmp / 5);
          tmp = 0;
        }
      }
      console.log(arr);
      console.log(aver);
    </script>
  </body>
</html>
